/*

BlackRabbit - OpenSource IDE.
@author Edward Sarkisyan (edward.sarkisyan@gmail.com)
Use LGPL (http://www.gnu.org/copyleft/lesser.html)

*/

#include "pluginscrollareawidget.h"
#include "ui_pluginscrollareawidget.h"

PluginScrollAreaWidget::PluginScrollAreaWidget(QWidget *parent, Plugin* pluginObject) :
    QWidget(parent),
    m_ui(new Ui::PluginScrollAreaWidget)
{
    m_ui->setupUi(this);
    if(pluginObject !=0)
    {
        m_plugin = pluginObject;
        m_ui->pluginName->setText(pluginObject->name());
    }
    else
    {
        m_plugin = 0;
        m_ui->pluginName->setText(QString());
    }
}
void PluginScrollAreaWidget::setAddButtonEnabled(bool yN)
{
    m_ui->addBttn->setEnabled(yN);
}

PluginScrollAreaWidget::~PluginScrollAreaWidget()
{
    delete m_ui;
}

void PluginScrollAreaWidget::changeEvent(QEvent *e)
{
    QWidget::changeEvent(e);
    switch (e->type()) {
    case QEvent::LanguageChange:
        m_ui->retranslateUi(this);
        break;
    default:
        break;
    }
}

void PluginScrollAreaWidget::on_addBttn_clicked()
{
    emit addBttnClicked(m_plugin);
    m_ui->addBttn->setEnabled(false);
}

void PluginScrollAreaWidget::setPluginIcon(QPixmap icon)
{
    m_ui->pluginIcon->setPixmap(icon);
}
